<html>
<head>
<title>javaScript定时切换图片</title>
<style type="text/css">
html,body,ul,li{
    margin:0;
    padding:0;
}
ul{
    list-style-type:none;
}
li{
    display:none;
}
    </style>
</head>
<body>
<ul id="img">
    <li style="block"><img src="logo_mil.gif" />1</li>
    <li style="none"><img src="t_note.gif" />2</li>
    <li style="none"><img src="/jscss/demoimg/wall_s3.jpg" />3</li>
</ul>
<script type="text/javascript">
(function(){
    var i=0;
    var $=function(ID){return document.getElementById(ID);};
    var timer=null,speed=1000;
    (function(){
        if(i>=$("img").getElementsByTagName("li").length){
            for(var j=0;j<$("img").getElementsByTagName("li").length;j++){
                $("img").getElementsByTagName("li")[j].style.display="none";
            }
            i=1;
            $("img").getElementsByTagName("li")[0].style.display="block";
        } else {
            for(var j=0;j<$("img").getElementsByTagName("li").length;j++){
                //console.log(j+""+i);
                if(j===i){
                    $("img").getElementsByTagName("li")[j].style.display="block";
                } else {
                    $("img").getElementsByTagName("li")[j].style.display="none";
                }
            }
            i++;
        }
        timer=setTimeout(arguments.callee,speed);
    })();
})();
</script>
</body>
</html>